//
//  FromWhereView.m
//  仿微信朋友圈
//
//  Created by dllo on 16/9/3.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "FromWhereView.h"
#import "SDAutoLayout.h"
@interface FromWhereView ()
@property (nonatomic, strong) UILabel *fromWherelabel;
@property (nonatomic, strong) UIView *grayView;
@end

@implementation FromWhereView
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createFromWhere];
    }
    return self;
}
- (void)createFromWhere {
    self.fromWherelabel = [UILabel new];
    self.picImageView = [UIImageView new];
    self.desLabel = [UILabel new];
    self.grayView = [UIView new];
    [self addSubview:_grayView];
    [self addSubview:_fromWherelabel];
    [_grayView addSubview:_picImageView];
    [_grayView addSubview:_desLabel];
    self.grayView.backgroundColor = [UIColor colorWithRed:0.936 green:0.951 blue:0.982 alpha:1.000];;
    self.desLabel.textColor = [UIColor colorWithRed:0.311 green:0.516 blue:1.000 alpha:1.000];
    self.picImageView.backgroundColor = [UIColor redColor];
    self.fromWherelabel.text = @"来自于";
    self.fromWherelabel.font = [UIFont systemFontOfSize:13];
    self.fromWherelabel.textColor = [UIColor colorWithWhite:0.800 alpha:1.000];
    self.desLabel.font = [UIFont systemFontOfSize:14];
    
    
    self.fromWherelabel.sd_layout
    .leftSpaceToView(self, 5)
    .rightSpaceToView(self, 5)
    .topSpaceToView(self, 20)
    .autoHeightRatio(0);
    self.grayView.sd_layout
    .leftSpaceToView(self, 5)
    .rightSpaceToView(self, 5)
    .heightIs(30)
    .topSpaceToView(self.fromWherelabel, 10);
    self.picImageView.sd_layout
    .topEqualToView(self.grayView)
    .leftEqualToView(self.grayView)
    .bottomEqualToView(self.grayView)
    .widthIs(40);
    self.desLabel.sd_layout
    .topSpaceToView(self.grayView, 0)
    .bottomSpaceToView(self.grayView, 0)
    .leftSpaceToView(self.picImageView, 5)
    .rightSpaceToView(self.grayView, 5);
    
    [self setupAutoHeightWithBottomView:self.grayView bottomMargin:0];
}
- (void)layoutSubviews {
    [super layoutSubviews];
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
